home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / graphics / mfpic / misc / MakeTeXPK < prev    next >
Text File  |  1992-11-25  |  4KB  |  193 lines

  1. #!/bin/sh
  2. #
  3. # MakeTeXPK - modified 06:25 GMT Thu 26 Nov 1992 by  Geoffrey Tobin
  4. #               (ecsgrt@luxor.latrobe.edu.au).
  5. #           - including an idea by  Gert W. Bultman  (bultman@dgw.rws.nl)
  6. #               to help find metafonts in the current directory.
  7. #
  8. #   This script file makes a new TeX PK font, because one wasn't
  9. #   found.  Parameters are:
  10. #
  11. #   name dpi bdpi magnification [[mode] subdir]
  12. #
  13. #   `name' is the name of the font, such as `cmr10'.  `dpi' is
  14. #   the resolution the font is needed at.  `bdpi' is the base
  15. #   resolution, useful for figuring out the mode to make the font
  16. #   in.  `magnification' is a string to pass to MF as the
  17. #   magnification.  `mode', if supplied, is the mode to use.
  18. #
  19. #   Note that this file must execute Metafont, and then gftopk,
  20. #   and place the result in the correct location for the PostScript
  21. #   driver to find it subsequently.  If this doesn't work, it will
  22. #   be evident because MF will be invoked over and over again.
  23. #
  24. #   Of course, it needs to be set up for your site.
  25. #
  26. # gt - added "MFDIR", to override default "mf", if necessary.
  27. MFDIR=/usr/local/bin
  28. #MFDIR=/usr1/TeX/TeX3.14/mf
  29. #TEXDIR=/usr/lib/tex
  30. TEXDIR=/usr/local/lib/tex
  31. #LOCALDIR=/LocalLibrary/Fonts/TeXFonts
  32. #DESTDIR=$LOCALDIR/pk
  33. DESTDIR=$TEXDIR/fonts/qume
  34. #
  35. # TEMPDIR needs to be unique for each process because of the possibility
  36. # of simultaneous processes running this script.
  37. #
  38. if test "$TMPDIR" = ""
  39. then
  40.    TEMPDIR=/tmp/mtpk.$$
  41. else
  42.    TEMPDIR=$TMPDIR/mtpk.$$
  43. fi
  44. NAME=$1
  45. DPI=$2
  46. BDPI=$3
  47. MAG=$4
  48. MODE=$5
  49.  
  50. umask 0
  51.  
  52. # Greeting added by Geoffrey Tobin, Wed 21 Oct 1992.
  53. echo "MakeTeXPK - a script for calling metafont from Rokicki's dvips"
  54.  
  55. if test "$NAME" = ""
  56. then
  57.    echo "  MakeTeXPK:  No font name!  "
  58. fi
  59.  
  60. if test "$DPI" = ""
  61. then
  62.    echo "  MakeTeXPK:  No dpi argument.  "
  63. fi
  64.  
  65. if test "$BDPI" = ""
  66. then
  67.    echo "  MakeTeXPK:  No base-dpi argument.  "
  68. fi
  69.  
  70. if test "$MAG" = ""
  71. then
  72.    echo "  MakeTeXPK:  No mag argument.  "
  73. fi
  74.  
  75. # Never mind, this is normal.
  76. #
  77. # if test "$MODE" = ""
  78. # then
  79. #    echo "  MakeTeXPK:  No mode argument.  "
  80. # fi
  81.  
  82. if test "$MODE" = ""
  83. then
  84. #   if test $BDPI = 300
  85.    if test "$BDPI" = ""
  86.    then #     skip it
  87.       MODE=""
  88.    elif test $BDPI = 300
  89.    then
  90. #      MODE=imagen
  91.       MODE=CanonCX
  92.    elif test $BDPI = 200
  93.    then
  94.       MODE=FAX
  95.    elif test $BDPI = 360
  96.    then
  97.       MODE=nextII
  98.    elif test $BDPI = 400
  99.    then
  100.       MODE=nexthi
  101.    elif test $BDPI = 100
  102.    then
  103.       MODE=nextscreen
  104.    elif test $BDPI = 635
  105.    then
  106.       MODE=linolo
  107.    elif test $BDPI = 1270
  108.    then
  109.       MODE=linohi
  110.    elif test $BDPI = 2540
  111.    then
  112.       MODE=linosuper
  113.    else
  114.       echo "I don't know the mode for $BDPI"
  115.       echo "Have your system admin update MakeTeXPK"
  116.       exit 1
  117.    fi
  118. fi
  119.  
  120. #  Something like the following is useful at some sites.
  121. # DESTDIR=/usr/local/lib/tex/fonts/pk.$MODE
  122. GFNAME=$NAME.$DPI'gf'
  123. PKNAME=$NAME.$DPI'pk'
  124.  
  125. # Clean up on normal or abnormal exit
  126. trap "cd /; rm -rf $TEMPDIR $DESTDIR/pktmp.$$" 0 1 2 15
  127.  
  128.  
  129. if test ! -d $DESTDIR
  130. then
  131.    mkdir $DESTDIR
  132. fi
  133.  
  134. if test "$6" != ""
  135. then
  136.    DESTDIR=$DESTDIR"$6"
  137.    if test ! -d $DESTDIR
  138.    then
  139.       mkdir $DESTDIR
  140.    fi
  141. fi
  142.  
  143. mkdir $TEMPDIR
  144. # Gert W. Bultman    bultman@dgw.rws.nl
  145. # next line added by gwb, to allow searching in current dir before cd'ing
  146. # The ":" added by Geoffrey Tobin, Wed 21 Oct 1992.
  147. MFINPUTS=${MFINPUTS}:`pwd`; export MFINPUTS
  148. echo "MFINPUTS is  $MFINPUTS"
  149. echo "TEMPDIR  is  $TEMPDIR"
  150. cd $TEMPDIR
  151.  
  152. if test -r $DESTDIR/$PKNAME
  153. then
  154.    echo "$DESTDIR/$PKNAME already exists!"
  155.    exit 0
  156. fi
  157.  
  158. # check also in the standard place
  159. # if test "$6" = ""
  160. # then
  161. #    if test -r $TEXDIR/fonts/pk/$PKNAME
  162. #    then
  163. #       echo $TEXDIR/fonts/pk/$PKNAME already exists!
  164. #       exit 0
  165. #    fi
  166. # else
  167. #    if test -r $TEXDIR/fonts/pk/$6"$PKNAME"
  168. #    then
  169. #       echo $TEXDIR/fonts/pk/$6"$PKNAME" already exists!
  170. #       exit 0
  171. #    fi
  172. # fi
  173.  
  174. echo mf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" \\\</dev/null
  175. $MFDIR/mf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" </dev/null
  176. if test ! -r $GFNAME
  177. then
  178.    echo "Metafont failed for some reason on $GFNAME"
  179.    exit 1
  180. fi
  181.  
  182. gftopk -v ./$GFNAME ./$PKNAME
  183.  
  184. # Install the PK file carefully, since others may be doing the same
  185. # as us simultaneously.
  186.  
  187. mv $PKNAME $DESTDIR/pktmp.$$
  188. cd $DESTDIR
  189. mv pktmp.$$ $PKNAME
  190.  
  191. exit 0
  192.